"use strict";const observer=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){let t=document.querySelector("#animated-svg path animate");t.beginElement()}})}),animatedSvg=document.querySelector("#animated-svg");observer.observe(animatedSvg);let screen,stars,params={speed:.2,number:900,extinction:.8},scrollTimer=null,lastScrollTime=0,lastScrollPosition=0,isScrolling=!1,canvas=null,ctx=null,timer=null;function Star(){this.x=Math.random()*canvas.width,this.y=Math.random()*canvas.height,this.z=Math.random()*canvas.width,this.move=function(){this.z-=params.speed,this.z<=0&&(this.z=canvas.width)},this.show=function(){let e,t,a,n;e=(this.x-screen.c[0])*(canvas.width/this.z),e+=screen.c[0],t=(this.y-screen.c[1])*(canvas.width/this.z),t+=screen.c[1],n=(a=canvas.width/this.z)>params.extinction?1.5*(2-a/params.extinction):1,ctx.beginPath(),ctx.fillStyle="rgba(255, 255, 255, "+n+")",ctx.arc(e,t,a,0,2*Math.PI),ctx.fill()}}function setupStars(){screen={w:window.innerWidth,h:window.innerHeight,c:[.5*window.innerWidth,.5*window.innerHeight]},window.cancelAnimationFrame(updateStars),canvas.width=screen.w,canvas.height=screen.h,stars=[];for(let e=0;e<params.number;e++)stars[e]=new Star}window.onload=function(){setTimeout(()=>{document.querySelector(".hyper").style.zIndex=1,decreaseOpacity(1,1),incrementOpacity(0,1),setTimeout(()=>{document.querySelector(".preloader").style.display="none",document.querySelector(".hyper").classList.remove("stop")},200)},150)},document.addEventListener("DOMContentLoaded",()=>{ctx=(canvas=document.querySelector(".hyper")).getContext("2d"),setupStars(),updateStars()}),window.addEventListener("scroll",function(){clearTimeout(scrollTimer),clearTimeout(timer);let e=new Date().getTime(),t=window.pageYOffset||document.documentElement.scrollTop,a=e-lastScrollTime,n=Math.abs(t-lastScrollPosition),s=n/a;n>50&&(params.speed=Math.abs(Math.max(Math.min(16,s),.2)-params.speed)>=.2?Math.max(Math.min(16,s),.2):params.speed,params.extinction=Math.abs(Math.min(Math.max(.8,s),3)-params.extinction)>=.2?Math.min(Math.max(.8,s),3):params.extinction),isScrolling=!isScrolling,lastScrollTime=e,lastScrollPosition=t,scrollTimer=setTimeout(function(){isScrolling=!1,params.speed=.2,decreaseValue(params.extinction,5)},100)}),window.addEventListener("resize",setupStars);const ref=window.matchMedia("(prefers-reduced-motion: reduce)").matches;function updateStars(){ctx.fillStyle="black",ctx.fillRect(0,0,canvas.width,canvas.height),stars.forEach(function(e){e.show(),e.move()}),ref||window.requestAnimationFrame(updateStars)}async function decreaseValue(e,t){for(let a=e;a>=.8;a-=.01)params.extinction=a,await new Promise(e=>timer=setTimeout(e,t))}async function decreaseOpacity(e,t){for(let a=e;a>=0;a-=.025)document.querySelector(".preloader").style.opacity=a,await new Promise(e=>timer=setTimeout(e,t))}function incrementOpacity(e,t){return new Promise(a=>{let n=e;!function e(){document.querySelector(".body").style.opacity=n,(n+=.025)<=1?setTimeout(e,t):a()}()})}